﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using V5_BLL;
using V5_Common;
using V5_Model;

namespace V5_EShop._Template.Default.Member
{
    public partial class Evaluate : BasicPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.check_member_login())
            {
                Response.Redirect("/login.aspx?returnurl=" + HTTPS.GetCurrentUrl());
            }
            if (!this.IsPostBack)
            {
                Bind_Ask();
                Bind_Answer();
            }
        }

        /// <summary>
        /// 我的商品提问
        /// </summary>
        private void Bind_Ask()
        {
            string strWhere = "";
            int Count = 0;
            strWhere = " MemberID=" + user.ID;
            this.Pager1.UrlRewritePattern = "/member/Evaluate.aspx?page={0}";
            this.rpList1.DataSource = new BLLProductAsk().GetList(Pager1.PageSize,
                Pager1.CurrentPageIndex,
                strWhere,
                ref Count).Tables[0];
            this.rpList1.DataBind();
        }
        /// <summary>
        /// 我的商品提问
        /// </summary>
        private void Bind_Answer()
        {
            string strWhere = "";
            int Count = 0;
            strWhere = " MemberID=" + user.ID;
            this.Pager2.UrlRewritePattern = "/member/Evaluate.aspx?page={0}";
            this.rpList2.DataSource = new BLLProductAnswer().GetList(Pager1.PageSize,
                Pager1.CurrentPageIndex,
                strWhere,
                ref Count).Tables[0];
            this.rpList2.DataBind();
        }

        protected void Pager1_PageChanged(object sender, EventArgs e)
        {
            this.Bind_Ask();
        }
        protected void Pager2_PageChanged(object sender, EventArgs e)
        {
            Bind_Answer();
        }
        /// <summary>
        /// 返回评价
        /// </summary>
        /// <param name="o"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public string Get_ImgPost(object o, string str)
        {
            string tempStr = "";
            int tempInt = Input.SetInt(o);
            for (int i = 0; i < tempInt; i++)
            {
                tempStr += str;
            }
            return tempStr;
        }
    }
}
